package weaver.interfaces.zjj.action;

import com.weaver.general.BaseBean;
import com.weaver.general.Util;
import weaver.conn.RecordSet;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;

/**
 * @Title: ecology-idea
 * @Company: 泛微软件
 * @author: weaver.Dusongsong
 * @version: 1.0
 * @CreateDate: 2022-07-05
 * @Description: ${description}
 * @ModifyLog:
 **/

public class WeaEditZwDocAction extends BaseBean implements Action {
    @Override
    public String execute(RequestInfo requestInfo) {
        String requestid = requestInfo.getRequestid();
        String tablename = requestInfo.getRequestManager().getBillTableName();
        RecordSet rs = new RecordSet();
        writeLog( ">>>>>>WeaEditZwDocAction>>>>>requestid="+requestid );
        try {
            rs.executeQuery( "select zw,zwpdf from " + tablename + " where requestid=?", requestid );
            rs.next();
            String zw = Util.null2String( rs.getString( "zw" ) );//"张三"

            String zwpdf = Util.null2String( rs.getString( "zwpdf" ) );
            String sql = "update "+tablename+" where set zw='"+zwpdf+"',zwdpd='"+zw+"' where requestid='"+requestid+"'";
            rs.executeUpdate(sql);
            writeLog( ">>>>>>sql>>>>>"+sql );
            return Action.SUCCESS;
        } catch (Exception e) {
            e.printStackTrace();
            requestInfo.getRequestManager().setMessageid( "111111" );
            requestInfo.getRequestManager().setMessagecontent( "Action接口异常！" );
            return Action.FAILURE_AND_CONTINUE;
        }
    }
}
